package cc.wanforme.fsync.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.util.Objects;

/** 机器 */
public class ClientNode {
    // ID 仅用于数据库记录
    @TableId(type = IdType.AUTO)
    private Long id;
    // 仅仅是个名字
    private String name;
    // 协议
    private String protocol = "http";
    // 地址
    private String host;
    // 端口
    private String port;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String base() {
        return protocol + "://" +host + ":" + port;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    @Override
    public String toString() {
        return super.toString();
    }

    public boolean customEquals(ClientNode o) {
        return Objects.equals(protocol, o.getProtocol())
                && Objects.equals(host, o.getHost())
                && Objects.equals(port, o.getPort());
    }
}
